You get alteration shards for selling identified magic/rare items and transmutation shards for selling unidentified items.
I have not been able to figure out a way to determine how many shards are given to me for a given item. Is the sale price dependent on your character's level? Item rarity? Type of magic property? Or something else that I have not thought of? Maybe a little of randomness is involved?
It just doesn't make sense to be only able to sell a rare for only 1 shard.