There is information here on Visual Servoing that maybe helpful; particularly the numerous references at the end of the article.
If you look at a bmp file of a smd image like this one (I could not find an image of the bottom of a smd).
You can see the white background as FF FF FF and one scan line across the component highlighted. So in theory one could find the four corners and calculated the rotation and any x y offset. In bmp files the image is inverted.
If you only need the rotation then only part of one edge would be required to calculate it I believe.