Yes it is correct. ('by missing' / 'when he missed') are also other options.
Biblio, the subject says "dangling modifier" so I think it's the 'missing the grammar quiz last Monday' part, as it doesn't have a subject and links to the other clause.
I can't admit it sounds perfectly normal, but I can't see a problem with it..
biblio is right, you should describe your question more clearly next time and let us know what you think
I am sorry I couldn't be clear enough. I am trying to explain what I thought the problem was:
I thought the part '....missing the grammar quiz last Monday' should be at the begining, because it, as such, stands like a relative clause definining 'trouble'. Thank you all.
The other day I saw a cockroach having my breakfast.
My idea of a dangling modifier is that it must allow for at least some abmbiguity as to the actual "doer" of the action, as in the example given. It is not clear whether I was having breakfast or the cockroach. Although the cockroach seems to be the likelier candidate because of the immediate proximity of the modifier.
In the example provided by you, the next possibility, apart from Pedrito, is, as you say, for "touble" to have missed a quiz, which is hardly very logical. So, I believe your example is not really ambiguous enough.