sampler TextureSampler; 
 
struct VS_INPUT { 
    float4 Position : POSITION0; 
    float2 Texcoord : TEXCOORD0; 
};
 
VS_INPUT NullVertexShader(VS_INPUT Input) { 
    VS_INPUT Output;
    
    Output.Position = Input.Position; 
    Output.Texcoord = Input.Texcoord; 
 
    return Output; 
} 
 
float4 InvertTexture(VS_INPUT Input) : COLOR0{ 
  
  const float offset = 1.0 / 512.0;
  half3 c = tex2D(TextureSampler, Input.Texcoord);
  half3 edge = tex2D(TextureSampler, Input.Texcoord + float2(-offset, -offset)) +
  tex2D(TextureSampler, Input.Texcoord + float2(-offset, 0.0)) +
  tex2D(TextureSampler, Input.Texcoord + float2(-offset, offset)) +
  tex2D(TextureSampler, Input.Texcoord + float2( 0.0, offset)) +
  tex2D(TextureSampler, Input.Texcoord + float2( offset, offset)) +
  tex2D(TextureSampler, Input.Texcoord + float2( offset, 0.0)) +
  tex2D(TextureSampler, Input.Texcoord + float2( offset, -offset)) +
  tex2D(TextureSampler, Input.Texcoord + float2( 0.0, -offset));

  edge.rgb = 8.0 * (c + -0.125 * edge);
  return float4(edge,1.0); 
} 
 
technique TransformTexture { 
    pass P0 { 
        VertexShader = compile vs_2_0 NullVertexShader(); 
        PixelShader = compile ps_2_0 InvertTexture(); 
    } 
}