Restoring object transformation data after execute 'apply' command
Script.



Grab the script from here

Basically its the rotation that needs to be reset, once it is axis aligned, scaling, translating and moving the origin are trivial.


Put the object into edit mode.
Select a face that has a normal and edge aligned to axes.
Run the script.
If the selected face didn't axis align, Undo  Ctrl Z,
and try with another face.