To summarize, there are no hard and fast rules, but there certainly are patterns that can guide us now and then. Each language naturally has its own patterns, so to my mind this is a legitimate question about English.
From short name to long name
There certainly is no way to guess what someone's full name is just from their short name, simply because information is missing. Meg contains few of the letters of Margaret. So you have to memorize it. And even English speakers don't know all of these connections. Just recently I was wondering if Curdie was short for another name after reading The Princess and the Goblin. (It isn't.)
And even when you do know the full list, you can guess wrong! If I meet someone named Jo, I don't know whether her full name is Josephine, Joanne, or Joanna. The original information from the full name just isn't recoverable. No doubt this is the same in any language.
From long name to short name
However, the other direction, trying to determine the short name based on the long name, is a little more promising. I will stress what the others have stressed so far: there are no hard and fast rules. But there are tendencies.
In the bizarre Homestar Runner cartoon "do over", there's a tongue-in-cheek sequence where Strong Bad takes the names Ashley and Anthony and tries to create nicknames for them:
Well, Ash and Ant, or Ley and Thony, or Shle and Ntho, or whatever you like to be called...
English speakers instantly recognize the last four as wrong. But they're wrong for interesting reasons.
Ntho for Anthony has a syllable-initial cluster /nθ/, which is impossible in English phonotactics. You can instantly rule out any short form of that kind!
Shle for Ashley can also be ruled out. We do allow /ʃl/ at the start of some borrowed names (e.g. Shlomo). But Shle has been broken at the wrong place in the word. It begins at a syllable coda instead of an onset. That is either disallowed or extremely rare.
Ley for Ashley is very unlikely. Why? Because it's formed from an unstressed syllable in Ashley (and one that sounds like just a diminutive suffix1 — more on that later). Short names are usually based on the primary stressed syllable: Rob for Robert, Bert for Bertrand, Randy for Randall. (There are exceptions, such as Elizabeth → Beth from the secondary stressed syllable or even → El from an unstressed syllable.)
For this reason, Ash is the correct and probably the only possible short form for Ashley.
Thony for Anthony is unlikely for a more complex reason. The correct form is Tony, which is a name originally more popular among Italians and hence based on the Italian version Antonio: where the stress is on -to- (ruling out Ant) and it has no h (ruling out Thony).
For this reason, Ant (sometimes Anth) corresponds to the Anglicized pronunciation Anthony.2
We can also add the use of a diminutive suffix. A common one is -y / -ie. This is what allows for Ellie (← Elizabeth), Jordie (← Jordan), Billy (← William), Sandy (← Sandra), Debbie (← Deborah), Danny (← Daniel), and many more. This is also why any English speaker might assume that Curdie is a short form, perhaps for Curtis: there is some regularity in the system!
It's true that some of these diminutives may be appended to an existing short form (e.g. it could be Daniel → Dan → Danny), but some of them replace parts of the longer name. To my knowledge, we have no short form Jord or Sand.
So those are some general guidelines for how to clip names to make shorter ones. We might be able to understand Josephine, for example. The primary stressed syllable Jo is inherently the most likely. I could also buy Feeny, taken from the secondary stressed syllable plus a diminutive. But the unstressed syllable Seph would be impossible.
But finally we must return to the observation that many names are not guessable. Among the most infamous are Margaret → Peg, William → Bill, and Richard → Dick. These names were crystallized long ago according to the phonology of an older English or even of a different language. (A linguist can see a reason for /w/ → /b/ or /m/ → /p/, but most of us are better off just to memorize these names.) I suspect that the older the name, the more unpredictable it is and the more variants it has.
And of course even our guidelines and patterns can be broken wilfully. Names are very personal and come with stories attached to them. P.E.Dant gives the example of Card for a hypothetical Richard who spent time in Costa Rica — and hence goes by the stressed syllable in the Spanish version of his name, Ricardo. There's a method to the madness, but there is madness.
1 Even though etymologically "Ashley" is not a diminutive but two nouns ash + leah.
2 The original name is the Latin Antonius. The h was added in English in the 17th century due to an incorrect connection made with the Greek word anthos.