HELP! Can anyone explain "weird" shader behaviour (affine "correction")

I’m trying to understand what’s going on with a shader.

I have a plane in a scene,

to which I apply the following shaders:
Vertex Shader

void main(void) {
    vCorners = aCorners / vec2(width, height);
    gl_Position = matrix_viewProjection * matrix_model * vec4(aPosition, 1.0);
    position = gl_Position;
    // affine correction
    gl_Position /= gl_Position.w;
}

Fragment Shader

void main() {
    vec2 UVs = vec2(vCorners.x, 1. - vCorners.y);
    gl_FragColor = texture2D(uColorBuffer, UVs);
}

Line 6: gl_Position /= gl_Position.w; is intended to correct affine aberration.
However, when the camera approaches the plane, it results in the plane being misplaced/transformed like so:

Whereas, it should be placed like this (as can be seen by removing line 6):

  1. What is happening?
  2. Why?
  3. How can it be corrected?
  4. Why didn’t I become a carpenter instead???
  5. Does god hate me?!?

I don’t want to jinx it, but I think I’ve finally fixed it.
Vertex shader

gl_Position = matrix_viewProjection * matrix_model * vec4(aPosition, 1.0);
vPosition = gl_Position;

vW = gl_Position.w;

Fragment shader

vec4 position = vPosition / vW;
vec2 uv = (position.xy + 1.0) / 2.;
gl_FragColor = texture2D(uColorBuffer, uv);

Basically, I’m applying w after the interpolation. Which seems wa-a-a-ay too easy but seems to work.