How to modify the mouse device driver in Ubuntu

Hi guys.

Working on a CS assignment and in need of some help. What I need to do is change the mouse driver so that when you move the mouse vertically, it will move the cursor horizontally instead etc.

How do I go about modifying the device driver to accomplish this? BTW I’m running Ubuntu on a VirtualBox environment.

Do you actually need to modify the driver or just the configuration.
Modifying the driver would assume that all students are using a device that has an open source driver.