Easy function for extracting variables from a slice of bytes.