Generalized Score Matching for General Domains