I know this is perlmonks and all, but have you looked the the tcprewrite app in the tcpreplay suite? I have used it to do exactly what you ask many times with great results.
http://tcpreplay.synfin.net/trac/
http://tcpreplay.synfin.net/trac/wiki/tcprewrite#RewritingLayer2