Complete tutorial with full source code:
Interactive video with 4 corner pin Motion-tracking (After effects + Flash)