Intuitively the difference seems clear but I had trouble understanding exactly how it works. Here is what I could figure out.
To show somebody something
Montrer quelque chose quelqu'un
is agrammatical, you need to use the preposition “à”, as in your first example
Montrer quelque chose à quelqu'un
Talking about persons
In this case, there is actually a difference between direct and indirect object. When you are talking about two different persons, “me” necessarily refers to the direct object (i.e. I am the person you are showing), whereas “à moi” is indirect (i.e. I am the person to whom you are showing someone).
Te montrer à moi
is correct, whereas
me te montrer
is not. You could however write
Me montrer à toi
Things and reflexive pronouns
Reflexive pronouns like “me” and “te” can also refer to an indirect object, but only if there is also a thing as a direct object in the sentence and you are not using “à […]”, as in
Me montrer sa voiture.
In this case,
Montrer sa voiture à moi
is understandable (and something children might say) but incorrect.
One thing that gets lost with the infinitive is that “montrer” can also be used reflexively, as in:
Je me suis montré [à toi]
In particular, “je me suis montré” can imply something like “I showed up so that people notice that I am here”.
But the principle identified before remains valid, when there is no other object, “me” is the direct, not the indirect object.
Note that while these constructions are grammatically correct and probably understandable, using “montrer” often sounds contrived in these examples. In many cases you would use “désigner” ou “présenter” instead.
You can also convey related ideas in a different way with a relative proposition, e.g.
Il m'a montré qui tu étais.
While the meaning is very different, the same principles are at play with “donner”.
Tu te donnes à moi
Je me donnes à toi
Je te donne un crayon
Another source of confusion
Confusingly, you will also encounter
Me montrer quelque chose à moi
where both “me” and “à moi” refer to the same person, the indirect object. It's a colloquial (possibly somewhat childish) way to mark emphasis (as in “I have seen it but you haven't”).
Thinking about this further
I think the most important clue to interpret these sentences correctly is to compare the subject, the reflexive pronoun and the indirect object. If they are all different, it's clear which is which. If you use the same person, you will get either a different meaning (“Je me […]”) or emphasis (“me […] à moi”).