http://wiki.dovecot.org/Migration/MailFormat shows a bunch of scripts, one of them claims to preserve UIDs.
Does anyone here have direct successful experience with this? I only asked about this because a comment on that same page says, "None of the solutions described below preserve the message UIDs."
Answering my own question. I did some experiments last night, and JulianFitzell's patched version of mb2md.pl, along with his migrateuser.sh script, looks like it works as advertised. (Local tweaks to the migrate scripts, but that's fair enough.) Thanks, Julian!
Commenting on my answer to my own question... :-)
For one MBOX folder for one user, total of over 5000 messages, a couple
of dozen messages got a warning to the effect of "can't parse date for
this message". Although I imagined that the resulting MAILDIR messages
would have bogus dates, it turned out that they had no headers at all.
The message files contained only the message bodies. (The user
complained, but I had him whacked so word wouldn't get out. :-)