2d Rectangle collision resolution: Find a rollback point

I have a two-part question:

I have 2 rectangles, A and B. B is a wall and A is moving. My simple logic here is every time A moves, it's based on an (x, y) offset and checks if it's colliding with something. When it collides with something, you roll back in the opposite direction bit by bit until it does not collide.

The problem here is, if A moves in big chunks, B could be completely skipped.

The intended behavior is to find out where A should be when it first touches one of the faces of B, then return to that point and apply the collision resolution.

What if B moves too?

What I am currently doing to get around this problem is to make enough collision boxes and make sure that moving objects do not move above a maximum. This approach seems to be limiting in the future.

I assume that there is a mathematical way to solve this problem, but I could not find any answers from my search queries. Any tips / suggestions will be appreciated.

Many Thanks!