vec2 safeScreenSize = (ScreenSize.x > 0.0 && ScreenSize.y > 0.0) ? ScreenSize : vec2(1920.0, 1080.0);
float aspectRatio = ScreenSize.x/ScreenSize.y;

vec2[] corners = vec2[](
    vec2(0.0, 1.0),
    vec2(0.0, 0.0),
    vec2(1.0, 0.0),
    vec2(1.0, 1.0)
);

bool isGui = ProjMat[3][3] == 1.0;

float guiScale = (round(safeScreenSize.x * ProjMat[0][0]));

float ScreenY(float value) {
    return value/safeScreenSize.y*guiScale;
}

float ScreenX(float value) {
    return value/safeScreenSize.x*guiScale;
}

vec2 Screen(vec2 values) {
    return values/safeScreenSize*guiScale;
}