To simplify, assume faces and corners of the square are labeled and the camera lens if whatever makes this simplest (a 90 degree field of view projection?)
The application: using a known and labeled unit square to assist an AR app.
For the case of a perfectly centered rotated on one axis, we can use the estimated distance from the axis the square was rotated around plus the ratio of sizes of the distorted sides.
But for an arbitrary view, the problem becomes much much harder.
Links to the general case of this problem in projective geometry also appreciated