Measure for Measure is a play that's full of substitutions. Duke Vincentio appoints Angelo as his deputy substitute at the play's very beginning, Mariana is substituted for Isabella during the infamous bed trick, and Angelo asks Isabella to substitute her maidenhead (chastity) for her brother's literal head. Ragusine's head is supposed to be substituted for Claudio's but, when he refuses to be executed, a dead pirate becomes the substitute's substitute instead.
What the heck's going on here?
Well, as literary critic Jonathan Crewe points out, "substitution is the general rule of the theater." In other words, on stage, actors are always substitutes for characters. So, every time a substitution takes place in Measure for Measure, Shakespeare makes us aware of the conventions of his profession as a playwright and as an actor on the Elizabethan stage. (This is something Shakespeare likes to do. A lot. If you don't believe us, check out what we have to say in "Themes: Art and Culture" in, say, Hamlet.)