Mechanics of magnet-controlled transfer printing