Gauge Invariance of the Yang-Mills Curvature Density