### ImageMagick version

7.1.1-29

### Operating system

Windows

### Operating system, version and so on

Windows 10 x64

### Description

Tiff image decoding seems to have totally no or totally incorrect respect of Orientation tag (274) depending of source file.

I have produced 2 test files. One from LZW-compressed image and another from JPEG-compressed image.
Both contain 5 frames that should produce clockwise rotation of image by changing the orientation tag in it's IFD:
TopLeft -> RightTop -> BottomRight -> LeftBottom -> TopLeft

When I view this images in some modern viewer, then it displays every frame according the embedded Orientation tag. 
(Checked in FastStone Image Viewer, XnView MP, IrfanView 64).

When I convert by ImageMagick such LZW-compressed tiff image to PNG's or PDF file then it produces 5 pages **without any rotation**.
When I convert such JPEG-compressed tiff image to PNG's or PDF file then it produces 5 pages **with page horizontal and vertical flipping** instead of rotation.

I'm sure that decoding of source tiff _should have the correct processing of orientation tag in any compatible compression format_ of tiff page, producing the different image orientation in target file pages. Especially when converting to pdf.

P.S. Also I checked these test images with ImageGlass viewer, which is based on ImageMagick's dll. It seems that viewer's programmers have implemented rotating of tiff page _after decoding_, but combining with unexpected flipping of jpeg-compressed pages **produces unpredictable results**.

### Steps to Reproduce

```
magick convert test_RotateClockwize_jpeg.tiff test_RotateClockwize_jpeg.pdf
magick convert test_RotateClockwize_lzw.tiff test_RotateClockwize_lzw.pdf

magick identify -verbose  test_RotateClockwize_jpeg.tiff > test_RotateClockwize_jpeg.tiff.txt
magick identify -verbose  test_RotateClockwize_lzw.tiff > test_RotateClockwize_lzw.tiff.txt

``` 

### Images

[Tiff rotation.zip](https://github.com/ImageMagick/ImageMagick/files/14496282/Tiff.rotation.zip)

Orientation tag bug in tiff image decoding.
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : Orientation tag bug in tiff image decoding.
Issue date:

--- start body ---
### ImageMagick version

7.1.1-29

### Operating system

Windows

### Operating system, version and so on

Windows 10 x64

### Description

Tiff image decoding seems to have totally no or totally incorrect respect of Orientation tag (274) depending of source file.

I have produced 2 test files. One from LZW-compressed image and another from JPEG-compressed image.
Both contain 5 frames that should produce clockwise rotation of image by changing the orientation tag in it's IFD:
TopLeft -> RightTop -> BottomRight -> LeftBottom -> TopLeft

When I view this images in some modern viewer, then it displays every frame according the embedded Orientation tag. 
(Checked in FastStone Image Viewer, XnView MP, IrfanView 64).

When I convert by ImageMagick such LZW-compressed tiff image to PNG's or PDF file then it produces 5 pages **without any rotation**.
When I convert such JPEG-compressed tiff image to PNG's or PDF file then it produces 5 pages **with page horizontal and vertical flipping** instead of rotation.

I'm sure that decoding of source tiff _should have the correct processing of orientation tag in any compatible compression format_ of tiff page, producing the different image orientation in target file pages. Especially when converting to pdf.

P.S. Also I checked these test images with ImageGlass viewer, which is based on ImageMagick's dll. It seems that viewer's programmers have implemented rotating of tiff page _after decoding_, but combining with unexpected flipping of jpeg-compressed pages **produces unpredictable results**.

### Steps to Reproduce

```
magick convert test_RotateClockwize_jpeg.tiff test_RotateClockwize_jpeg.pdf
magick convert test_RotateClockwize_lzw.tiff test_RotateClockwize_lzw.pdf

magick identify -verbose  test_RotateClockwize_jpeg.tiff > test_RotateClockwize_jpeg.tiff.txt
magick identify -verbose  test_RotateClockwize_lzw.tiff > test_RotateClockwize_lzw.tiff.txt

``` 

### Images

[Tiff rotation.zip](https://github.com/ImageMagick/ImageMagick/files/14496282/Tiff.rotation.zip)

--- end body ---

None