sampler SAMPLER : register (s0);
float4 params : register(c0);   // params.x is desaturation amount. 0=gray 1=color
float4 color_for_alpha : register(c3); // Passed through to the BatchRenderer::Draw call

////////////////////////////////////////////////////////////////
///
/// main
///
////////////////////////////////////////////////////////////////
void main(in float2 in_texcoord0 : TEXCOORD0,
		  out float4 out_color0 : COLOR0)
{
    float x = in_texcoord0.x - 0.5;
    float y = in_texcoord0.y - 0.5;
    if ((x * x + y * y) > 0.25)
    {
        clip( -1);
    }
    float4 tex = tex2D(SAMPLER, in_texcoord0);
    float greyscale = dot(tex.rgb, float3(0.30, 0.59, 0.11));
    out_color0.rgb = lerp(float3(greyscale, greyscale, greyscale), tex.rgb, params.x)*color_for_alpha.a;
    out_color0.a = tex.a*color_for_alpha.a;
}