The title of this thread is the solution - motion tracking. The most basic motion tracking / stabilising in AE will do this.