In fully booted guest OS:
sudo apt-get install zerofree
Reboot guest OS, hold [Esc] on boot, and from Grub menu select Advanced, then Recovery Mode, then Root Console, and run:
zerofree /dev/sda
halt
Then in host OS, run:
vboxmanage modifymedium disk $VDI_FILENAME --compact