Linear and invariant behavioral templates underlie visual discrimination in rats