Update your microcontroller VSYNC & HSYNC to be inline with displaying a 320 (column) x 240 (row) image or a 240x320 image.

In the 320x240 case, there should be 240 HSYNC pulses and for 240x320 there should be 320 HSYNC pulses.