Who gave this rule and when?
Allah gave this rule when He revealed the ayaat:
And whosoever does not judge by what Allah has revealed, such are the Kafirun...And whosoever does not judge by that which Allah has revealed, such are the Zalimun [Surah Al-Ma'idah (5): 44-45]
Who defines what is shariah?
Allah and His Messenger (sal-allahu alayhi wa salam) define what is Shari'ah and our understanding of it is based upon the understanding of the companions (radiAllahu anhuma) of Allah's Messenger (sal-allahu alayhi wa sallam) unless people, who appeared after them, believe that they understand Islam more than the sahabas (radiAllahu anhuma).