Compositing: How the resize the scene to fit the matte?
You can use a Plane Track Deform: in doing so, you'll be able to apply the scene both on a rectangle or a deformed plane.




Open the "matte image" in the Movie Clip Editor on "Tracling" mode
Add 4 markers near the corners





Select all the markers and add a Plane Track





Drag the corners to fit the "hole" you want to fill with your scene
Open the Node Editor and the Plane Track Deform (add > distort > plane track deform)