There is endless number of solutions, as I see it.
First, make a long belt and put a weight on its lower side (so two gears and weight form a triangle). This is ugly.
Second (what people usually do if they have money) use two motors, one for each gear.
Third, replace your setup with sort of robotic arm - and put belts along it.
Fourth, use a solid rod along the A - B line and conic gears, so that rotation is passed. You will have to make second (B) set of gears slide along the rod, but it is doable.
Easiest approach would be to use flexible spring-like device to pass the rotating momento.
If you need specifics, look at OLD dental drills, they had couple of solutions for that task: google up "dental drill with belts" and click "images".
===
robotics.snowcron.com