If you have access to both sides, have someone hold the movable piece up to the hole, mark the outline, then cut outside the line and sand to fit. Easy peasy.
If you can't get to both sides, you could get creative with double-sided tape to put a handle on the movable piece to do the same thing.
As far as securing it to the immobile piece, there are lots and lots of ways to do that. You could glue/tack a "rim" of wood around the movable piece and just glue it in place. You could also secure some pieces of wood across the corners of the hole on the immobile piece and then just set the movable piece into position and glue.
Again, lots of good ways to skin this cat, just depends on what you fee like doing.