That's a custom cut register to fit so close to the wall; you don't want a new one or you'll just have to do that again (which isn't fun).
The problem is the mangled boot. Straighten it as best you can with some pliers. Then attach it like it's supposed to be with some screws into the flooring/subfloor. Find the corner it likes to sit in, biased to either side. Screw the side in with two screws. Then the hard part: screw it down to the room side (may need a right angle drive, and pilot holes). Or screw it down to the wall side after you slip some wood back there to preserve the clearance from the wall.
When you screw it in make it as flush with the floor as possible. When you go to put the register back, stick it in at a 45 and then slide it sideways as you push it down. That may be all you have to do but the problem will persist, and it won't be as air-tight as it could be. Ideally the boot is taped to the floor which the register will hide.