SSH into the box, or open a local terminal.

From here, you can launch the following to enable screen sharing with a specified password:

sudo /System/Library/CoreServices/RemoteManagement/ -activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes -clientopts -setvncpw -vncpw password1 -restart -agent -privs -all

Now you should be able to VNC into your machine! When you are finished, you can run the following command to disable screen sharing:

sudo /System/Library/CoreServices/RemoteManagement/ -deactivate -configure -access -off