I'm assuming you've already generated a separate provisioning profile from Apple (developer.apple.com).
You might want to put your ipa and provisioning profile in an empty folder for these steps.
Unpack the ipa, replace the embedded provisioning profile:
unzip "App.ipa"
rm -f "Payload/App.app/*.mobileprovision"
cp "DEV.mobileprovision" "Payload/App.app/embedded.mobileprovision"
If your dev profile uses a different bundle ID or BuildTeam:
/usr/libexec/PlistBuddy -c "Set :CFBundleIdentifier <dev bundle ID>" Payload/*.app/Info.plist
/usr/libexec/PlistBuddy -c "Set BuildTeam <team ID>" Payload/*.app/AppInfo.plist
Extract the entitlements and put them in temp plists, if you're using a wildcard provisioning profile, also replace the wildcard with your bundle ID:
security cms -D -i Payload/*.app/embedded.mobileprovision > PP.plist 2>&1
sed -i '' "s/\*/<bundle ID>/g" PP.plist
/usr/libexec/PlistBuddy -x -c "Print Entitlements" PP.plist > entitlements.plist 2>&1
Code sign app, repack ipa, remove temp Payload and plists:
/usr/bin/codesign --force --preserve-metadata=identifier,entitlements --sign "<signing ID>" --entitlements entitlements.plist -i "<bundle ID>" Payload/*.app
zip -r "ShinyNewApp.ipa" Payload
rm -rf Payload
rm -f *.plist