You can change the screen resolution by editing /etc/X11/xorg.conf. On Debian and Ubuntu-based systems, you can also fix it automatically by issuing the command
sudo dpkg-reconfigure xserver-xorg-core
On Debian, you need to switch to the root user, instead of preceding the command with "sudo."