Correction formula for two points This is painfully simple- sorry for that- but I'm not a math guy and could use some help.  Imagine I have a surface that goes from $(0,0)$ to $(100,100)$- a square.  On it, I expect to find two points from a previous measurement at $(10,10)$ and $(90,90)$- lets just say they were marked somehow.  But someone messed with my surface.  The rotated it, translated it, or both- all within the same plane.
Now when I go to look for my expected $(10,10)$ point $1$, I find that it is actually at $(8,13)$.  And when I then look for my point $2$, I find it at $(95,80)$ (or something close where the distance between the points has not changed).
What is the formula I need to take any expected $(x,y)$ and apply a correction to yield my true $(x,y)$ position?
This is not a homework problem btw.  It's a real world problem.
 A: It depends on what structure you have on the function! It seems like you're talking about affine maps, so far. Affine maps are similar to linear maps that are isomorphisms, and can be treated either as linear isomorphisms up to translation, or as linear maps projecting a higher-dimensional space onto the affine space as a subset of projective space. If the origin were fixed, the map's values would be determined by the law $f(x+y)=f(x)+f(y)$. This would mean that if you added many copies of the same vector - tracing out a line - you would be able to add as many copies of the transformed vector to get the transform's value at the vector. So, what you need to calculate all the results of an affine map, i.e. a linear map plus a translation, is its value at a third point, which you can pretend is the origin of lines to the two values you know. Call this point $O$, and the transformation $T$. Then $(T(x)-T(O))+(T(y)-T(O)) = T(x+y)-T(O)$.
A: Here is some C# code:
using System;
using System.Windows;

class Mapper
{
   public static Point MapPoint(Point a1, Point a2, Point b1, Point b2, Point p)
   {
      Vector u = a2 - a1;         // Vector along source line a1-a2
      Vector v = b2 - b1;         // Vector along destination line b1-b2

      Point am = a1 + 0.5*u;      // Mid-point of line a1-a2
      Point bm = b1 + 0.5*v;      // Mid-point of line b1-b2

      double factor = 1 / (u.Length * v.Length);
      double cosA = (u*v) * factor;
      double sinA = Vector.CrossProduct(u,v) * factor;

      double x = (p - am).X * cosA - (p - am).Y * sinA + bm.X;
      double y = (p - am).X * sinA + (p - am).Y * cosA + bm.Y;

      return new Point(x,y);
   }

   static void Main(string[] args)
   {
      Point a1 = new Point(2,1);    Point a2 = new Point(8,5);   Point am = new Point(5,3);
      Point b1 = new Point(1,3);    Point b2 = new Point(5,9);   Point bm = new Point(3,6);

      Point p, q;
      p = a1;
      q = MapPoint(a1, a2, b1, b2, p);  
      Console.WriteLine("a1 maps to: " + q.ToString());  // q should = b1

      p = a2;  
      q = MapPoint(a1, a2, b1, b2, p);  
      Console.WriteLine("a2 maps to: " + q.ToString());  // q should = b2

      p = am;  
      q = MapPoint(a1, a2, b1, b2, p);  
      Console.WriteLine("am maps to: " + q.ToString());  // q should = bm

      Console.ReadLine();
   }
}

It uses the Point and Vector structures from System.Windows (in the WindowsBase assembly).
The important part is the MapPoint function. It maps an input point $p$ to an output point that is returned by the function. The mapping is defined by four points $a_1$, $a_2$, $b_1$ and $b_2$. The idea is that the "source" points $a_1$ and $a_2$ are mapped (roughly) to the destination points $b_1$ and $b_2$ respectively. This mapping will only be exact if the distances $a_1a_2$ and $b_1b_2$ are equal. In fact, what actually happens is that the mid-point of $a_1a_2$ is mapped to the mid-point of $b_1b_2$.
The test code in the Main function shows that things are working correctly. The mid-point $a_m$ gets mapped to $b_m$, as expected. Also, in this case, $a_1$ gets mapped to $b_1$ and $a_2$ gets mapped to $b_2$, since the distances distances $a_1a_2$ and $b_1b_2$ are equal.
