You could use glFrustum to achieve this.
If you use the standard perspective matrix and the camera is facing the box in front, X / Y will be uniform, however the movement from the camera will move the X / Y coordinates to the center, reducing them for the standard parallax effect. What you painted is the movement to the top parts of the window. All you have to do is crop the perspective projection below its standard center. What is where glFrustum enters - move normally symmetric upper / lower arguments down, align the camera / view matrix along the desired axis, and you should have the desired projection.
Any rotation of the camera / view will destroy the uniform projection in the X / Y plane. To move the camera, you are then limited to panning and moving the borders of glFrustum .
EDIT Come up with this, you could just add glTranslatef(shearX, shearY, 0) before calling gluPerspective and achieve the same.
source share