difference of angles? (image bug fixed)

Hello there everyone... I could really use some help with a question. I'm in the middle of making a 3d game engine... and there's just this one problem that I can't seem to get through... It's difficult to explain, so here:http://aycu30.webshots.com/image/989...4825285_th.jpg is a quick picture I made to make it easier to understand what I need...

You are given the values of A,B,C,D, and theta... what I need is a simple equation (or equations) that I could use to find ? for any real values of A,B,C,D, and theta. Is that even possible? I would appreciate anything (the sooner the better...) Thank you in advance.

- Scott