SV_POSITION not usable in Pixel Shader

Hello, I’m joining the Monogame community, and I’m having a problem trying to use the pixel position on the screen to make a rounded cutout.

Sprite Effect template:

#if OPENGL
    #define SV_POSITION POSITION
    #define VS_SHADERMODEL vs_3_0
    #define PS_SHADERMODEL ps_3_0
#else
    #define VS_SHADERMODEL vs_4_0_level_9_1
    #define PS_SHADERMODEL ps_4_0_level_9_1
#endif

Texture2D SpriteTexture;

sampler2D SpriteTextureSampler = sampler_state
{
    Texture = <SpriteTexture>;
};

struct VertexShaderOutput
{
    float4 Position : SV_POSITION;
    float4 Color : COLOR0;
    float2 TextureCoordinates : TEXCOORD0;
};

float4 MainPS(VertexShaderOutput input) : COLOR
{
    return tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color;
}

technique SpriteDrawing
{
    pass P0
    {
        PixelShader = compile PS_SHADERMODEL MainPS();
    }
};

this shader compiles without any problem, but if I use input.Position to check the pixel position on the screen, a compilation error is thrown.

float4 MainPS(VertexShaderOutput input) : COLOR
{
    if (input.Position.x > 500.0){
        discard;
    }
    return tex2D(SpriteTextureSampler,input.TextureCoordinates) * input.Color;
}

Compilation error using mgwindowsdx:

Error MSB3073, without additional information

Compilation error using mgdesktopgl or mgandroid:

Error X4502 : invalid ps_3_0 input semantic ‘POSITION’
Error X4502 : invalid input semantic ‘POSITION’: Legal indices are in [1,15]
Error X4502 : invalid ps_3_0 input semantic ‘POSITION’

Usage in dotnet 7.0 + mglib

_spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,null,null,null,_effect);

where _effect is the Effect imported using Content.mgcb

Any information is welcome, thanks in advance

The y coordinates are inverted (point 0 as in the Cartezian plane), which goes against the standard established by MonoGame, of course, this can be solved using a uniform, but is it really the right way to do this? And also mgwindowsdx (Windows Desktop Application) witch uses DirectX is also a priority.

Solution:

1 - Change VS_SHADERMODEL and PS_SHADERMODEL in DirectX, and remove the SV_POSITION definition

#if OPENGL

    #define VS_SHADERMODEL vs_3_0

    #define PS_SHADERMODEL ps_3_0

#else

    #define VS_SHADERMODEL vs_4_0

    #define PS_SHADERMODEL ps_4_0

#endif

2 - In OpenGL the y coordinates are inverted (point 0 as in the Cartetian plane), therefore uniform with the screen size (only the height is enough):
`

// define in C# using uniforms, like 1920 x 1080
float2 RenderingSize;

3 - Invert the y coordinates:


    float2 fragPos = input.Position.xy;
    #ifdef OPENGL
    fragPos.y = RenderingSize.y - fragPos.y;
    #endif
    //now the fragPos is the position of the pixel in screen