HLSL - Clip Pixel based on Screen Position

If you don’t want to limit yourself to whichever devices support the HiDef profile, I think there are other ways around this.

In 3D, I would just add another position_copy field to the pixel shader input, and set it in the vertex shader to be the same as the position you tried to use. Maybe someone else can chime in if there’s a more appropriate way to do this with a SpriteBatch since you don’t need to define your vertex shader. You could also transform your texture coordinate to get the position, but that would require passing in other parameters and seems even more difficult.