How should I shim a foundation vent?
The vent is almost the same size as the masonry opening in width, since the vent is plastic, I would use a table saw to reduce the top and bottom flanges to get it to fit between the top and bottom row of brick and trim the edges the small amount needed as well.

After that, set the vent inside the brick opening enough to bear against the mortar that is still in the opening. Hopefully that is at least 1/2". I think it would look better if it was an inch at least, but it is not needed. It only needs to be deep enough to form an inside corner to take a bead of caulk to seal out the unwanteds.
Or if you choose, you can tuck in a little mortar around the perimeter to do the same, but the more the vent is recessed, the more durable the repair will be. That means you might need to remove the original mortar to do so.It would be good to dampen the brick slightly first if you choose the mortar route.

Good luck.

PS. If you want to be sure that no vermin will get through, chisel out the rest of the masonry cement, (stay away from the outside corner, they will chip off in a heartbeat) dampen the brick as mentioned before and smear some mortar into the opening before you push in the vent, some mortar will inherently squeeze around the frame, the mix will need to be like a peanut butter maybe even toothpaste looseness. After the vent is set, place the remaining cement around the perimeter, this will lock it in real good.
Then again caulk will do pretty good too.