struct input
{
   float2 video_size;
   float2 texture_size;
   float frame_direction;
};

void main_vertex
(
   float4 position : POSITION,
   out float4 oPosition : POSITION,
   uniform float4x4 modelViewProj,
   float2 tex : TEXCOORD,
   out float2 oTex : TEXCOORD
)
{
   oPosition = mul(modelViewProj, position);
   oTex = tex;
}

float4 main_fragment (uniform input IN, float2 tex : TEXCOORD, uniform sampler2D s0 : TEXUNIT0) : COLOR
{
   float max_y = IN.video_size.y / IN.texture_size.y;
   float ycoord = IN.frame_direction < 0.0f ? max_y - tex.y : tex.y;
   return tex2D(s0, float2(tex.x,ycoord));
}

