How to pass projectionMatrix and modelViewMatrix into MainVS in UE4 shader programming?

void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4(position.x,position.y, position.z);
}

void MainVS(
    in uint GlobalVertexId :SV_VertexID,
    out float2 OutVertexDistortedViewportUV :TEXCOORD0,
    out float4 OutPosition :SV_POSITION
    )
{

}

What are you trying to do exactly? The first code block you provided looks like GLSL, which you have to code manually. Unreal Engine has a node-based shader workflow, meaning you don’t have to (and shouldn’t) write shader code by hand.

Does the example linked below contain the information you mentioned?