How do I create a mask that tracks its position in the source file?

This may be an After Effects 101 question, but I've spent a lot of time looking for an answer so here goes.

Let's say I have a poster on a wall that I want to remove. The camera is panning past the wall, so it needs to be tracked. I could time-freeze the video, make a patch out of another portion of the wall using a mask, and then track that still-frame patch over the poster and it's gone. But, what if there are constant light changes on the wall from passing cars? How do I create a patch that changes dynamically with the source footage it is masked from?

My usual workflow is: Instead of time-freezing anything, I duplicate my layer, stabilize it so that the section I want stays in the same place for the whole duration, then mask that section and attach it to the tracked object I want removed. This is tedious and almost never works as well as I'd like.

I am sure there is a built-in way to do this, right? What's the easiest way?

if you simply wanted to replace the poster (or cover it) with another poster, or similar shaped item, then i'd recommend either doing a corner pin track in AE or using Mocha to do a planar track (you should be able to find tutorials on both).

to remove the poster, i would try doing a similar track, but you'll also need to create a patch that will match the surface that you are removing, and that could be pretty tricky depending on the surface... but if you can make a good patch you can likely get it to work with the tracking data from either a corner pin track or planar track, just make you patch large enough to feather the edges out a bit.

Yes, that is how I usually cover things if the situation is simple and there are no lighting changes, but what I'm trying to figure out here is how to do this without freezing the frame in order to create the mask. If I just create a patch using a clean portion of the surface (freezing time in order to do so,) then it will not blend in with all of the light changes occurring on that surface.

I just discovered "Track Mask", which is very close to what I'm looking for, but it still feels clunky. I want to be able to track a clean section of wall and apply the mask to those tracking points to create the patch, and then pickwhip that patch onto a different tracking point/null object.

you might try using the corner pin tracking on a separate layer to use as a track matte for the main footage layer to make a hole in it.

then position a copy of the footage behind that footage layer with the track matte in a way that it can fill the hole with a clean section of wall. since it's footage ins read of a still, it might allow for the changes in lighting....