This optical illusion is taking advantage of the 3D techniques of perspective angles and shading to create this impossible square. The surfaces and corners of the square in this drawing are not in the same position they would be if it were a normal square, drawn in proper perspective. Also, the upper right and lower left corners are cut off.
The added shading helps the eye track the surface as was intended which adds to the optical illusion.