Q:

Can you install vanilla Android on any phone?

I have an Samsung Galaxy S3. TouchWiz is great, but I want to use the vanilla Android OS you see on the Nexus 4. Is this possible?

A:

In theory, it should be possible to compile Android from source, with proprietary blobs for the specific device. 
In practice, however, this is largely impossible, with the exception of Nexus devices and those from community dev-friendly manufacturers like Sony.
Samsung, in particular, is notorious for providing terribly (un)organized sources, and even the talented hackers of Cyanogenmod team are frustrated, and many have sold off their devices and moved to Sony and Nexus devices.
So, your only realistic option is to install a community ROM like CM10.1. Again, it is not bug-free or fully featured as stock firmware.

A:

Yes, there's two avenues:

Download a vanilla AOSP ROM that targets SGSIII provided

Your handset is rooted and running custom recovery
Flash the update.zip of that AOSP ROM that targets the same.

Build your own from scratch provided

Your desktop computer, have heaps of disk space and running Linux 64bit
Heaps of RAM, 8Gb minimum, and is a quad core or better
Download the android source from the official code repository.
Populate the device tree that matches your device, with proprietary blobs
Have an hour or two of free time as it takes a while to compile and finally spit out a system.img, boot.img and update.zip

