Sergio Perez finished an action-packed Monaco Grand Prix in 10th position, only to be penalised after the race.