Currently, TWRP backups don't include
/data/media, and this doesn't appear to be on the developers' radar at all (the issue for it over at GitHub is just a bunch of +1s with no official response). Now that we have SELinux to contend with, simply copying the files back and forth is apparently no longer an option, and there are a number of different ways to access
/data/media throughout the filesystem, each with different effective owners and permissions.
In excruciating detail, how should I approach backing up and restoring
/data/media so everything is restored exactly as it was and my apps don't have trouble with the resulting permissions?