Determine position in space from distortion of image
Using a webcam, I will be capturing frames of an object of known size. The object is rectangular in shape. I would like to be able to determine my position in space relative to the object.
The object which I will be looking at has key features that I know how to identify to get the 4 corners of the rectangle. The points will be distorted based on my location and I'd like to be able to figure out where I am relative to the object from doing some sort of transformation.
How do I go about doing this? It is for a robotics project running on a Raspberry Pi so performance is somewhat important and I don't need pinpoint accuracy.