Yes there are, it's Article 50 of the Treaty on European Union. Scotland, Gibraltar, or whatever other country/region, will be considered as new applications for EU membership as the previous application was by a "different" country. This was reiterated by the EU during the Scottish referendum, this is no different.