Rebuild master database only in sqlserver 2012
Well, you cant. So your only option is to backup msdb, model and distribution rebuild the system databases from setup and then restore the backups.

If that is not an option, i.e. the sql server does not start you can rebuild the system databases, then install all patches until your server is on the same build level as before, turn off the sql server service and copy the database files for the other system databases over the current ones, remembering to take a copy of them first.