Does anyone know an algorithm for determining the rigid body transformation that best fits the motion of a set of N points?

I.e. given a set of initial points p0 p1 ... pN, and their locations after some motion, q0 q1 ... qN, I want to find the rigid body transformation T(x) (rotation and translation only) that minimizes:
  Sum[i=0...N] ( || T(pi) - qi ||^2 )

The only thing I can think of is to treat it as a generic nonlinear optimization problem, but it just seems like there should be something more efficient than that.