I believe what you are asking for is referred to as Projective Transformation or Homography - and is a very well studied concept in computer graphics. Simply googling those two terms should get you well on your way to implementing a perspective transform algorithm in your favorite language.
The easiest and currently most popular method in CG for solving this is using a system of linear equations to solve for the desired projected coordinates (geometric corrected). To really understand this stuff, you basically need a couple semesters of calculus and at least one course in linear algebra and/or Diff EQ.
But here are some good sources to get started:
The Wikipedia article on Homography:
A really great explanation on math.stackexchange (But again, unless you have a foundation of calculus and linear algebra, this stuff may be a bit confusing).