Screen position in pixel shader


I’m trying to write a shader with logic dependent on fragment’s screen position.

Basically that’s what gl_Position is from vertex shader, which is usually a result of matrix_viewProjection * matrix_model * vertex_position.

In pixel shader screen position is expected to be calculated with something like this:
vec4 pos = matrix_viewProjection * vec4 (vPositionW, 1.0);

But that doesn’t produce the intended result. When testing it with code like this:
vec3 emission = pos.x > 0.5 ? vec3 (0.0, 1.0, 0.0) : vec3 (1.0, 0.0, 0.0);

I get colors split not in screen space, but with some virtual plane of sort:

Here is the project:

How do I achieve perfect screen space shader logic?