If you had migrated your library properly from your previous computer this would not be an issue.
You should be able to:
- Backup the device to the new installation
- Transfer your purchases into a newly authorized library
- Recover any other media using third party tools as suggested in this post
- Restore the device from the backup
This process should switch the association of the device to the new library, preserving the data and settings in your apps.
May also be prudent to attempt a backup to iCloud directly from the device before you start... Settings > iCloud > Storage & Backup > iCloud Backup > On. It won't save any media but it would preserve the general account settings and documents in case anything goes wrong while you are trying to extract your other data.
When you get it all fixed, make a backup!