As I was writing yesterday, I realized that my code was sloppy, particular to my needs, and nearly unusable. I refactored the script to be more intuitive. When called, the script switches to the desktop specified by the first argument (it's zero-indexed), drops in a new background image list, and updates the background. The background changes a few hundred ms after switching, but it's good enough for me.
Here are directions for using it: