   [HLSL] Tiled texture overlay is drawn unevenly.
  I'm currently taking a texture from a texture atlas and tiling it across a single transparent quadrangle that is drawn on the near plane with an orthographic camera projection.  The transparent quadrangle is drawn last and used as an overlay effect that sits on top of the final render in order to produce a fake dot matrix type effect.The problem is that the texture is drawn unevenly and is stretched in some areas and not in others:My HLSL shader file code is as follows://=============================================//---[XNA to HLSL Variables]-------------------//=============================================float2 AtlasDim;// float2(Width, Height)texture AtlasTexture;float2 HalfPixel;// Texel to pixelfloat4 NumTiles;float2 ScreenDim;float4 SourceRectangle;// Source rectangle for texture//=============================================//---[Texture Samplers]------------------------//=============================================sampler TextureSampler = sampler_state   {  Texture = <AtlasTexture>;  MinFilter = Point;  MagFilter = Point;  MipFilter = Point;  AddressU = Clamp; AddressV = Clamp;};//=============================================//---[Structs]---------------------------------//=============================================struct VertexShaderInput{    float4 Position: POSITION0;    float2 TextureCoordinates: TEXCOORD0;};struct VertexShaderOutput{    float4 Position: POSITION0;float2 TextureCoordinates: TEXCOORD0;   };struct PixelShaderOutput{float4 Colour: COLOR0;};//=============================================//---[Functions]-------------------------------//=============================================// Adjust uv coordinates so they use the correct texture from the texture atlasfloat2 CalculateAtlasUV(float2 UV, float4 SourceRectangle){float2 atlasUV;atlasUV.x = UV.x * (SourceRectangle.z / AtlasDim.x);// Scale uv coordinatesatlasUV.x += SourceRectangle.x / AtlasDim.x;// Shift (rectangle offset from left of atlas)    atlasUV.y = UV.y * (SourceRectangle.w / AtlasDim.y);    atlasUV.y += SourceRectangle.y / AtlasDim.y;    return atlasUV;}//=============================================//---[Vertex Shaders]--------------------------//=============================================VertexShaderOutput VertexShaderFunction(VertexShaderInput input){    VertexShaderOutput output;    output.Position = input.Position;// [Texel To Pixel Align] // • Half pixel offset for correct texel centering)// • Should be done AFTER transformationoutput.Position.xy -= HalfPixel;output.TextureCoordinates = input.TextureCoordinates;    return output;}//=============================================//---[Pixel Shaders]---------------------------//=============================================PixelShaderOutput PixelShaderFunction(VertexShaderOutput input){PixelShaderOutput output;// To tile the texture so that it isn't stretched it must be tiled as a factor of the screen dimensions:// x = ScreenWidth / TextureWidth// y = ScreenHeight / TextureHeightinput.TextureCoordinates.x *= ScreenDim.x / SourceRectangle.z;// Number of tiles per rowinput.TextureCoordinates.y *= ScreenDim.y / SourceRectangle.w;// Number of tiles per columnfloat2 tile = frac(input.TextureCoordinates);tile = CalculateAtlasUV(tile, SourceRectangle);output.Colour = tex2D(TextureSampler, tile);    return output;}//=============================================//---[Techniques]------------------------------//============================================= technique Default{    pass Pass0    {VertexShader = compile vs_3_0 VertexShaderFunction();   PixelShader = compile ps_3_0 PixelShaderFunction();    }}The overlay texture is 2 x 2 pixels and both dimensions are a factor of the screen width/height.How can I prevent the overlay from being drawn unevenly?   
  Problem solved, I was setting the wrong value for HalfPixel:Weird thing is that I get dark bands when in full screen in XNA but they don't show with Fraps.  This is because XNA insists on applying bilinear filtering to the whole screen (including text and overlay) when in full screen mode.Can anyone please tell me how to stop this from happening?   