A derelict Georgian mansion will be brought back into use as a care home after planning permission was granted.