Well defining sanity is a bit difficult, what's easier is defining insanity and having sane people be "those who are not insane".
So let us define insanity. First of all, insanity is a social construct and thus is subjected to social beliefs, this means our definition must be relative (IE: Based on other people, rather than a full enclosed definition). This means that if we wanted to get the most general and rigorous definition of insanity that would apply to all societies, then the textbook definition of insanity in the DSM-V won't be suitable.
So an insane person is someone who believes significantly different things to the normal populace, here normal = majority opinion. But it's important to note that not all people who do not agree with the normal populace are insane, in fact a majority aren't. Also different "beliefs" have different weighting, so here is what I would say is the criteria for being insane, as general as possible.
You are insane if:
1. You frequently hear, see, feel, taste or smell something that a great majority of people in the area can't sense that is not explainable by a physical alteration.
2. You have an obsessive belief that is shared by a minority of people that you refuse to disbelieve even if others propose logical contradictions (that a majority of people find valid) within your belief, such as circular logic or paradoxes.
Here insanity is a purely social thing, so depending on the set of reference frames you choose (IE: The society you decide to be in) your status of insanity and sanity may change. If you tick any of the 2 conditions you are insane within that given reference set, if you don't tick any of the conditions you are sane.